import axios from '@/utils/axios'


export const getMessage = (id: number): Promise<ApiResult<Message>> => {
    return axios.get(`message/${id}`)
}

export const getMessageList = (): Promise<ApiResult<Message[]>> => {
    return axios.get(`message/list`)
}

export const getMessageTree = (): Promise<ApiResult<Message[]>> => {
    return axios.get(`message/tree`)
}

export const postMessage= (data: Message): Promise<ApiResult<null>> => {
    return axios.post(`message`, data)
}

export const putMessage = (data: Message): Promise<ApiResult<null>> => {
    return axios.put(`message`, data)
}

export const deleteMessage = (id: number): Promise<ApiResult<null>> => {
    return axios.delete(`message/${id}`)
}

export const getMessageListByParentId = (id: number): Promise<ApiResult<Message[]>> => {
    return axios.get(`message/list/${id}`)
}

export const getMessageTreeNotLeaf = (): Promise<ApiResult<Message[]>> => {
    return axios.get(`message/tree/not/leaf`)
}
